<template>
	<view class="my">
		<view class="my_haber" :style="{ paddingTop: (top+30) + 'px' }">
			<tui-navigation-bar maxOpacity="0" :titleSize="18" :titleLineHeight="18" :titlefontWeight="800"
				@init="initNavigation" title="我的" backgroundColor="#fff" color="#000">

			</tui-navigation-bar>
		</view>
		<view class="my_content">
			<view class="clientInfoTitle">
				<view class="lt"></view>
				<view class="rt"><text>我的公司</text></view>
			</view>
			<view class="mybgTxt">
				<text>{{shopDetails&&shopDetails.merchantName}}</text>
			</view>
			<view class="clientInfoContent">
				<view class="item">
					<view class="iteml"><text>负责人</text></view>
					<view class="itemr"><text>{{shopDetails&&shopDetails.chargePerson}}</text></view>
				</view>
				<view class="item">
					<view class="iteml"><text>地址</text></view>
					<view class="itemr"><text>{{shopDetails&&shopDetails.address}}</text></view>
				</view>
				<view class="item">
					<view class="iteml"><text>联系电话</text></view>
					<view class="itemr"><text>{{shopDetails&&shopDetails.contactNumber}}</text></view>
				</view>
				<view class="item">
					<view class="iteml"><text>营业时间</text></view>
					<view class="itemr">
						<text>{{shopDetails&&shopDetails.startTime}}-{{shopDetails&&shopDetails.endTime}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="my_items">
			<!-- <view class="my_item" @tap="goMyCode">
				<view class="item_lt">
					<image class="lt_icon" src="/static/tutor/my/icon_tuiguangma@2x.png"></image>
					<text>我的推广码</text>
				</view>
				<image class="item_rt" src="/static/tutor/my/icon_right@2x.png"></image>
			</view> -->
			<view class="my_item" @tap="goMyDistributionInfo">
				<view class="item_lt">
					<image class="lt_icon" src="/static/tutor/my/icon_fenxiaomingxi@2x.png"></image>
					<text>我的分销明细</text>
				</view>
				<image class="item_rt" src="/static/tutor/my/icon_right@2x.png"></image>
			</view>
			<view v-if="auditStatus" class="my_item" @tap="toPersonalDetails">
				<view class="item_lt">
					<image class="lt_icon" src="/static/tabbar/tutor/message_active.png"></image>
					<text>我的个人信息</text>
				</view>
				<image class="item_rt" src="/static/tutor/my/icon_right@2x.png"></image>
			</view>
		</view>

		<view class="rounded bgBDFCF5 flex align-center justify-center mx-3 py-2 ft333333" style="margin-top: 100px;"
			@click="logout">退出登录
		</view>
	</view>
</template>

<script>
	import Cache from "@/utils/cache"
	import {
		getShopDetails
	} from "@/http/api/shop/shop.js"
	import {
		getAuditStatus
	} from "@/http/api/user/user.js"
	export default {
		data() {
			return {
				shopDetails: {},
				top: 0,
				marginTp: 0,
				auditStatus: false
			}
		},
		mounted() {
			this.details()
			getAuditStatus().then(res => {
				if (res.code === 200) {
					this.auditStatus = true
				}
			})
		},
		computed: {
			merchantId() {
				return this.$store.state.userTutorDetails.merchantId
			},
		},
		methods: {
			initNavigation(e) {
				this.top = e.top;
				this.marginTp = e.height
			},
			//获取当前教练商家信息
			details() {
				getShopDetails(this.merchantId).then(res => {
					if (res.code === 200) {
						this.shopDetails = res.data
					}
				}).catch(err => {
					console.log(err)
				})
			},
			back() {
				uni.navigateBack({
					delta: 1
				});;
			},
			goMyCode() {
				uni.navigateTo({
					url: '/pages/my/modules/myCode/myCode'
				})
			},
			goMyDistributionInfo() {
				uni.navigateTo({
					url: '/pages/my/modules/myDistributionInfo/myDistributionInfo'
				})
			},
			toPersonalDetails() {
				uni.navigateTo({
					url: '/pages/personalDetails/personalDetails'
				})
			},
			logout() {
				Cache.claer()
				uni.reLaunch({
					url: '/pages/my/modules/userLogin/userLogin'
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	@import './my.scss';
</style>